﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Tradex;
using Tradex.Trading;

namespace Tradex.Connectivity.ConnectorModel {

    /// <summary>
    /// The ITradingConnectorCallback defines the callback interfaces for a connector allowing trades. The connector uses
    /// these callbacks to inform Tradex about trade related events.
    /// </summary>
    public interface ITradingConnectorCallback {

        /// <summary>
        /// Reports an update on the accounts available on the connector. This includes all the keys for
        /// valid accounts.
        /// </summary>
        /// <param name="accounts"></param>
        void AccountsUpdate(
            AccountKey [] accounts
        );

        /// <summary>
        /// Updates the situation within an account.
        /// </summary>
        /// <param name="account"></param>
        /// <param name="update"></param>
        /// <param name="position"></param>
        void AccountUpdate(
            AccountKey account, AccountUpdate update, PositionUpdate position
        );

        /// <summary>
        /// Updated the information for an order. Except for the accountKey all other information is optional.
        /// </summary>
        /// <param name="account"></param>
        /// <param name="order"></param>
        /// <param name="connectionKey"></param>
        /// <param name="update"></param>
        /// <param name="execution"></param>
        void OrderUpdate(
            AccountKey account,
            OrderKey order, OrderId connectionKey,
            OrderUpdate update, OrderExecution execution
        );

        /// <summary>
        /// Updates the vailable working / registered / active orders for an account. This method contains a number
        /// of order information in different arrays. All element with the same index belong to one structure
        /// (we basically only avoid having a custom structure in this place at the moment).
        /// </summary>
        /// <param name="accountKey"></param>
        /// <param name="orders"></param>
        void OrdersUpdate(
            AccountKey accountKey,
            //OrderKey [] orderKey,
            //OrderId [] orderId,
            //OrderInfo [] orderInfo,
            OrderUpdate[] orders
        );

    }

}
